<?php

declare (strict_types = 1);

namespace app;

use DomainException;

/**
 * 分页改写类
 * @mixin Collection
 */
class Paginator extends \think\Paginator  
{
    
    /**
     * 渲染分页html
     * @return mixed
     */
    public function render()
    {

    }

    /**
     * 转换为数组
     * @return array
     */
    public function toArray(): array
    {
        try {
            $total = $this->total();
        } catch (DomainException $e) {
            $total = null;
        }

        return [
            'total'         => $total,
            'pageCount'     => ceil($total/$this->listRows),
            'page'          => $this->currentPage(),
            'list'          => $this->items->toArray(),
        ];
    }

}
